﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Main_AjaUtils_ChatMessagesTxtbox : System.Web.UI.Page
{
    /*page defaults*/
    OfficeOnlineUser currentUser;

    private void AuthenticateUser()
    {
        try
        {
            currentUser = (OfficeOnlineUser)Session["CurrentUser"];
        }
        catch (Exception ex)
        {
            //Response.Redirect("../login.aspx?urlReferrer=" + Request.Url);
        }

        if (currentUser == null)
        {
            //Response.Redirect("../login.aspx?urlReferrer=" + Request.Url);
        }
    }
    /*end page defaults*/

    ChatRoom room = new ChatRoom();

    protected void Page_Load(object sender, EventArgs e)
    {
        AuthenticateUser();
        TextBox box = (TextBox)FindControl("messagearea");
        box.Text = GetRoomMessages();        
    }

    public String GetRoomMessages()
    {
        ChatRoom room = new ChatRoom();
        room.ID = Request.QueryString["roomID"];
        return room.ReadMessage();
    }
}
